<?php 
class Logout extends CI_Controller {
	public function index() {
    	if ($this->customer->isLogged()) {
			
      		$this->customer->logout();
			
	  		$this->hkcart->clear();
			
			$this->session->unset_userdata('shipping_address_id');
			$this->session->unset_userdata('shipping_method');
			$this->session->unset_userdata('shipping_methods');
			$this->session->unset_userdata('payment_address_id');
			$this->session->unset_userdata('payment_method');
			$this->session->unset_userdata('payment_methods');
			$this->session->unset_userdata('comment');
			$this->session->unset_userdata('order_id');
			$this->session->unset_userdata('coupon');
			
			$this->tax->setZone($this->cconfig->get('config_country_id'), $this->cconfig->get('config_zone_id'));
			
      		redirect(site_url('account/logout'));
    	}
 
    	$this->lang->load('account/logout');
		
		$this->document->setTitle($this->lang->line('heading_title'));
      	
		$data['breadcrumbs'] = array();

      	$data['breadcrumbs'][] = array(
        	'text'      => $this->lang->line('text_home'),
			'href'      => site_url('common/home'),        	
        	'separator' => false
      	);
      	
		$data['breadcrumbs'][] = array(
        	'text'      => $this->lang->line('text_account'),
			'href'      => site_url('account/account'),       	
        	'separator' => $this->lang->line('text_separator')
      	);
		
      	$data['breadcrumbs'][] = array(
        	'text'      => $this->lang->line('text_logout'),
			'href'      => site_url('account/logout'),
        	'separator' => $this->lang->line('text_separator')
      	);	
		
    	$data['heading_title'] = $this->lang->line('heading_title');

    	$data['text_message'] = $this->lang->line('text_message');

    	$data['button_continue'] = $this->lang->line('button_continue');

    	$data['continue'] = site_url('common/home');
		
		$data['header'] = helper_load_header();
		$data['column_left'] = helper_load_left();
		$data['column_right'] = helper_load_right();
		$data['content_top'] = helper_load_top();
		$data['content_bottom'] = helper_load_bottom();
		$data['footer'] = helper_load_footer();
		
		
		$this->load->view("common/success", $data);
		
		
  	}
}
?>